package _09define;

public class Demo {
    public static void main(String[] args) {
        Employer employer=new Employer("zs",24,0);
        employer.setSalary(0);

    }
}
class Employer{
    public String name;
    private int age;
    private double salary;

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    public Employer(String name, int age, double salary) {
        this.name = name;
        setAge(age);
        setSalary(salary);
    }

    public double getSalary() {
        return salary;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAge(int age) {
        if (age>0&&age<100){
            this.age = age;
        }else System.out.println("年龄不合法！！！");

    }

    public void setSalary(double salary) {
        if (salary >0) {
            this.salary = salary;
            System.out.println(salary);
        }else System.out.println("工资不合法！！！");

    }
}
